<!-- {if $member_from eq 'seller'}-->
		{include file=member.header.html}
        <!--{else}-->
       {include file=buyer.header.html}
        <!--{/if}-->
<script type="text/javascript">

$(function(){
    regionInit("region");
    $("#portrait").val('');
    $('#profile_form').validate({
        errorLabelContainer: $('#warning'),
        invalidHandler: function(form, validator) {
           var errors = validator.numberOfInvalids();
           if(errors)
           {
               $('#warning').show();
           }
           else
           {
               $('#warning').hide();
           }
        },
        onkeyup : false,
        rules : {
            real_name : {
                checkRealname: true
            },
            im_qq : {
                isQQ: true
            },
             phone_tel : {
                isPhone : true
            },
            phone_mob : {
                isMobile : true
            }
        },
        messages : {
             im_qq : {
                isQQ : 'qq号码不正确. '
            },
             phone_tel : {
               isPhone : '电话号码不正确. '
            },
             phone_mob : {

                isMobile : '手机号码不正确. '
            }
        }
    });
    // 创建一个上传参数
    var uploadOption =
    {
        // 提交目标
        action: "{$site_url}/index.php?app=member&act=ajax_uploadify",
		// 服务端接收的名称
		name: "Filedata",
        // 自动提交
        autoSubmit: true,
        // 选择文件之后…
        onChange: function (file, extension) {
            //if (new RegExp(/(jpg)|(jpeg)|(gif)|(png)/i).test(extension)) {
           // } else {
             //   alert("只限上传jpg,jpeg,gif,png格式图片文件，请重新选择！");
           // }
        },
        // 开始上传文件
        onSubmit: function (file, extension) {
            $("#state").show().html("正在上传" + file + "..");
        },
        // 上传完成之后
        onComplete: function (file, response) {
            var rs = eval("("+response+")");
            if (rs.state)
            {
                var img_url = "{$site_url}/"+rs.msg;
                $("#state").hide();
                $('img[ectype="avatar"]').attr('src', img_url);
                $("#portrait").val(rs.msg);
            }
            else 
            {
                alert(rs.msg);
                $("#state").hide();
            }
            
        }
    }

    // 初始化图片上传框
    var oAjaxUpload = new AjaxUpload('#selector', uploadOption);  
});
</script>
<!-- 内容 -->
<div class="content f-cb">
		<!-- 当前位置 -->
		{include file=path.html}
		<!-- 内容左边栏 -->
        <!-- {if $member_from eq 'seller'}-->
		{include file=member.menu.html}
        <!--{else}-->
        {include file=member.menu.buyer.html}
        <!--{/if}-->
		<!-- 内容右边栏 -->
		<div class="con-shop-r">
        <div class="public">
            <form method="post" enctype="multipart/form-data" id="profile_form">
                <div class="information">
                    <!--{if !$edit_avatar}-->
                    <div class="photo width13">
                        <p id="photoimg"><img src="<!--{if $profile.portrait}-->{$profile.portrait}?{$random_number}<!--{else}-->{$site_url}/data/system/default_user_portrait.gif<!--{/if}-->" width="120" height="120" alt="" ectype="avatar" /></p>
                        <b>
                            <div id="selector" class="txt b-radius">{$lang.change_portrait}</div>                            
                        </b>
                        <div style="line-height:20px;padding-top:10px;">仅支持jpg、jpeg、gif、png，最优规格：120*120，文件小于500K</div>
                        <div id="state"></div>
                        <input type="hidden" value="" name="portrait" id="portrait" />
                    </div>
                    <!--{/if}-->
                    <div class="info individual">
                        <div id="warning"></div>
                        <table>
                            <tr>
                                <th class="width4">{$lang.user_name}: </th>
                                <td>{$profile.user_name|escape}</td>
                            </tr>                           
                            <tr>
                                <th>{$lang.real_name}:</th>
                                <td><input type="text" class="text width_normal b-radius" name="real_name" maxlength="30" value="{$profile.real_name|escape}" /></td>
                            </tr>
                            <tr>
                                <th>{$lang.gender}: </th>
                                <td class="label">
                                    <label>
                                       <input type="radio" name="gender" value="0" {if $profile.gender eq 0}checked="checked"{/if} />{$lang.unknown}  </label>
                                        <label>
                                        <input type="radio" name="gender" value="1" {if $profile.gender eq 1}checked="checked"{/if} />{$lang.male}   </label>
                                        <label>
                                        <input type="radio" name="gender" value="2" {if $profile.gender eq 2}checked="checked"{/if} />{$lang.female} </label>
                                </td>
                            </tr>
                            <tr>
                                <th>{$lang.region}: </th>
                                <td><div id="region">
                                        <input type="hidden" name="region_id" value="{$profile.region_id}" id="region_id" class="mls_id" />
                                        <input type="hidden" name="region_name" value="{$profile.region_name|escape}" class="mls_names" />
                                        <!-- {if $profile.region_id} -->
                                        <span>{$profile.region_name|escape}</span>
                                        <input type="button" value="{$lang.edit}" class="edit_region" />
                                        <select style="display:none" onchange="hide_error();">
                                          <option>{$lang.select_pls}</option>
                                          {html_options options=$regions}
                                        </select>
                                        <!-- {else} -->
                                        <select onchange="hide_error();">
                                          <option>{$lang.select_pls}</option>
                                          {html_options options=$regions}
                                        </select>
                                        <!-- {/if} -->
                                        <b class="field_message" style="font-weight:normal;"><label class="field_notice"></label></b>
                                      </div></td>
                            </tr>                            
                            <tr>
                                <th>{$lang.im_qq}:</th>
                                <td> <input type="text"   maxlength="15" onkeyup="this.value=this.value.replace(/\D/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))" class="text width_normal b-radius" name="im_qq" id="im_qq" value="{$profile.im_qq|escape}" /></td>
                            </tr>
                            <tr>
                                <th>{$lang.phone_tel}:</th>
                                <td><input type="text"  maxlength="20"   class="text width_normal b-radius" name="phone_tel"  id="phone_tel" value="{$profile.phone_tel|escape}" /><label class="field_message"><span class="field_notice">区号-电话号码-分机</span></label></td>
                            </tr>
                            <tr>
                                <th>{$lang.phone_mob}:</th>
                                <td><input type="text"  maxlength="11" onkeyup="this.value=this.value.replace(/\D/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))"   class="text width_normal b-radius" name="phone_mob"  id="phone_mob" value="{$profile.phone_mob|escape}" /></td>
                            </tr>
                            <!--{if $edit_avatar}-->
                            <tr>
                                <th>{$lang.portrait}:</th>
                                <td>{$edit_avatar}</td>
                            </tr>
                            <!--{/if}-->
                            <tr>
                                <th></th>
                                <td><input type="submit" class="btn b-radius" value="{$lang.save_edit}" /></td>
                            </tr>
                        </table>
                    </div>
                </div>
            </form>
            </div>
      </div>
	</div>
    <!-- 页脚 -->
{include file=footer.html}